<!--Copyright (C) 1988-2005 by the Institute of Global Environment and Society (IGES). See file COPYRIGHT for more information.-->

<html>
<head>
<title>GrADS Command: q pos</title>
</head>
<body bgcolor="e0f0ff" text="#000000">

<h2><b>q pos</b></h2>
<p>
After this command is issued, GrADS waits for user's mouse click, then
returns the coordinates of the mouse click plus additional
information. It is the returned information that makes '<code>q
pos</code>' such a powerful command especialy when used in conjunction
with the different 'classes' of widgets: buttons, rubber bands, and
dropmenus.  Here is a template of the information that '<code>q
pos</code>' returns after a mouse click (note the difference in output
between the different widget classes):

<p> <code>Position = <i>xpos ypos mbtn class </i>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</code> 
  (somewhere in the graphics window) <br>
<code>Position = <i>xpos ypos mbtn class widget# btnstate</i>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</code> (for buttons) <br>
<code>Position = <i>xpos ypos mbtn class widget# xpos2 ypos2</i>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</code> (for rbands) <br>
<code>Position = <i>xpos ypos mbtn class widget# menuitem &lt;casc# cascitem&gt;</i>&nbsp</code> (for dropmenus) <br>

<p>
where:
<ul>
<code><i>xpos, ypos</i>&nbsp&nbsp&nbsp&nbsp</code>
- coordinates of the mouse click in virtual page units <br>

<code><i>mbtn</i>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</code>
- either 1, 2, or 3 for the left, center, or right mouse button <br>

<code><i>class</i>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</code>
- either 1, 2, 3, or 0 for button, rband, dropmenu, or 'not a widget' <br>

<code><i>widget#</i>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</code>
- the number assigned to the widget when it was originally set up <br>

<code><i>btnstate</i>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</code>
- either 0 (meaning "off") or 1 (meaning "on") <br>

<code><i>xpos2, ypos2</i>&nbsp&nbsp</code>
- coordinates of the mouse release point in virtual page units <br>

<code><i>menuitem</i>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</code>
- the item number selected from the menu list <br>

<code><i>casc#</i>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</code>
- the cascade menu number selected from the dropmenu list <br>

<code><i>cascitem</i>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</code>
- the item number selected from the cascade menu <br>

</ul>

<p>
<h3>Usage Notes</h3>
<ol>
<li>If the user did not click on a widget, then
<code><i>class</i></code> will be 0 and there will be no further
output.
<p>
<li>If the user clicks on a dropmenu but no menu item is selected,
then <code><i>widget#</i></code> and <code><i>menuitem</i></code>
will both be -1.
<p>
<li>There can be up to three levels of nested cascading dropmenus launched
from the main dropmenu. In other words, <code><i>casc#</i></code> and <code><i>cascitem</i></code> will
repeat up to three times in the output from '<code>q pos</code>'. 
<p>
<li>
The following reference pages contain information on configuring and drawing the widgets:<br>
<a href="gradcomdsetbutton.html"><code>set button</code></a> <br> 
<a href="gradcomddrawbutton.html"><code>draw button</code></a> <br> 
<a href="gradcomdredrawbutton.html"><code>redraw button</code></a> <br>
<a href="gradcomdsetrband.html"><code>set rband</code></a> <br>
<a href="gradcomdsetdropmenu.html"><code>set dropmenu</code></a> <br>
<a href="gradcomddrawdropmenu.html"><code>draw dropmenu</code></a>
</ol>
<p>
<h3>Examples </h3>
<p>
See the section of the User's Guide on <a href="script.html#widgets">widgets</a>
for plenty of script examples showing how to use 'q pos'. 

</body>
</html>


